package 反射;

import java.lang.reflect.Method;

public class 反射_5_类的方法 {
    public static void main(String[] args) throws ClassNotFoundException {
        Class c1 = Class.forName("反射.反射_2_父类");

        System.out.println(c1.getName());

        //获取公共的方法
//        Method[] c2 = c1.getMethods();
        Method[] c2 = c1.getDeclaredMethods();//全部方法

        for (Method c2_1 :c2){
            System.out.println("方法名"+c2_1.getName());
            System.out.println("返回值类型"+c2_1.getReturnType());
            System.out.println("修饰符"+c2_1.getModifiers());

            Class[] c3 = c2_1.getParameterTypes();
            for (Class c3_1 : c3){
                System.out.println("参数名称："+c3_1.getName());
                System.out.println("-------");
            }
        }
    }
}
